/*
 * $Author: cbeams $
 * $Date: 2007-06-04 19:47:27 +0000 (Mon, 04 Jun 2007) $
 * $Rev: 26 $
 */
package com.db4o.eclipse.plugin.model;

import com.db4o.reflect.ReflectField;


public class Db4oStoredObjectInstance extends TreeParent {

    private final Db4oStoredClass storedClass;
    private final Object object;

    public Db4oStoredObjectInstance(Db4oStoredClass storedClass, Object object,
                                    ReflectField[] fields) {
        super(object.toString());
        this.storedClass = storedClass;
        this.object = object;
        for (ReflectField field : fields) {
            field.setAccessible();
            this.addChild(new Db4oStoredObjectInstanceField(field.get(this.object), field));
        }
    }

    public Db4oStoredClass getDb4oStoredClass() {
        return storedClass;
    }

    public Object getObject() {
        return object;
    }
}
